package java06;

import java.util.HashMap;
import java.util.Map;

public class zy07 {
    public static void main(String[] args) {
        String str1 = "ppRYYGrrYBR2258";
        String str2 = "YrR8RrY";
        System.out.println(checkStrings(str1, str2));
    }

    public static String checkStrings(String str1, String str2) {
        Map<Character, Integer> charCountMap = new HashMap<>();
        str1.chars().forEach(c -> charCountMap.put((char) c, charCountMap.getOrDefault((char) c, 0) + 1));

        for (char c : str2.toCharArray()) {
            if (!charCountMap.containsKey(c) || charCountMap.get(c) <= 0) {
                return "NO";
            }
            charCountMap.put(c, charCountMap.get(c) - 1);
        }

        return "YES " + (str1.length() - str2.length());
    }
}

